<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul{
    list-style: none;
    width: 500px;
    height: 500px;
    margin: auto;
    background-color: rosybrown;
    border: 1px solid red;
}
li{
    color: #ffff;
 margin: 0 0 10px 4px;
    width: 120px;
    height: 240px;
    float: left;
   background-color:#000000;
}
.box{
    width: 500px;
    height: 50px;
    margin: auto;
    background-color: #867676;

}
p{
    float: left;
    display: none;
}
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
    </ul>
<div class="box">
      <p style="display: block;">1</p>
      <p>2</p>
      <p>3</p>
      <p>4</p>
      <p>5</p>
      <p>6</p>
      <p>7</p>
      <p>8</p>
</div>
</body>
</html>
<script>
    let pop=document.getElementsByTagName('p')
    console.log(pop);
let arr=document.getElementsByTagName('li')
for (let i=0;i<arr.length;i++){
arr[i].onmouseover=function(){
    this.style.backgroundColor="#ffff"
this.style.color="red"

}
arr[i].onmouseout=function(){
    this.style.backgroundColor="#000000"
this.style.color="#ffff"
}
}
for (let i=0;i<pop.length;i++){
    pop[i].onmouseover=function(){
        this.style.display="block"
    }
}
</script>